import java.io.*;
/**
 * @author smy
 */
public class BinaryCode {
   public static String[] decode(String source){
    String[] returnvalue=new String[2];
    StringBuilder returnvalue1[]=new StringBuilder[2];
    returnvalue1[0]=new StringBuilder(200);
    returnvalue1[1]=new StringBuilder(200);
    StringBuilder test[]=new StringBuilder[2];
    test[0]=new StringBuilder(200);
    test[1]=new StringBuilder(200);
    int testtemp1=0,testtemp2=0;
	char source1[]=source.toCharArray();
    int flag1=1,flag2=1;
    int r=source.length();
    char a[]=new char[r];
    char b[]=new char[r];
    int convertedsource[]=new int[r];
    int original1[]=new int[r];
    int original2[]=new int[r];
    String[] test2=new String[2];
    test2[0]=new String();
    test2[1]=new String();
    for (int i=0;i<source.length();i++){
       convertedsource[i]=source1[i]-'0';
    }
    if (r>1){
    original1[0]=0;original2[0]=1;
    if(convertedsource[0]==2){flag1=0;original2[1]=1;}
    if(convertedsource[0]==0){flag2=0;original1[1]=0;}
    if(convertedsource[0]==1){original1[1]=1;original2[1]=0;}
    for (int i=2;i<r;i++) 
    {original1[i]=convertedsource[i-1]-original1[i-1]-original1[i-2];
    original2[i]=convertedsource[i-1]-original2[i-1]-original2[i-2];}
    //need to determine if the results are right
    testtemp1=original1[0]+original1[1];
    test[0].append((char)(testtemp1+'0'));
    testtemp2=original2[0]+original2[1];
    test[1].append((char)(testtemp2+'0'));
    for (int i=1;i<r-1;i++){
    	testtemp1=original1[i-1]+original1[i]+original1[i+1];
    	testtemp2=original2[i-1]+original2[i]+original2[i+1];
    	test[0].append((char)(testtemp1+'0'));
    	test[1].append((char)(testtemp2+'0'));
    }
    testtemp1=original1[r-2]+original1[r-1];
    testtemp2=original2[r-2]+original2[r-1];
    test[0].append((char)(testtemp1+'0'));
    test[1].append((char)(testtemp2+'0'));
    test2[0]=test[0].toString();
    test2[1]=test[1].toString();
    if(!test2[0].equals(source))flag1=0;
    if(!test2[1].equals(source))flag2=0;
    //Determine ends
    
    for(int i=1;i<r-1;i++){
    	testtemp1=original1[i-1]+original1[i]+original1[i+1];
    	if(testtemp1!=convertedsource[i]){flag1=0;break;}
    }
    for(int i=1;i<r-1;i++){
    	testtemp2=original2[i-1]+original2[i]+original2[i+1];
    	if(testtemp2!=convertedsource[i]){flag2=0;break;}
    }
    if (flag1==1){
    for (int i=0;i<r;i++)
    {a[i]='0';
    if (original1[i]==1)a[i]++;
    returnvalue1[0]=returnvalue1[0].append(a[i]);
    }
    returnvalue[0]=returnvalue1[0].toString();
    }
    else {
    returnvalue[0]="NONE";}
    if (flag2==1){
    for (int i=0;i<r;i++)
    {b[i]='0';
    if (original2[i]==1)b[i]++;
    returnvalue1[1].append(b[i]);
    }
    returnvalue[1]=returnvalue1[1].toString();
    }
    else {
    returnvalue[1]="NONE";}
    }
    else if(convertedsource[0]==2 || convertedsource[0]==3) {
    returnvalue[0]="NONE";
    returnvalue[1]="NONE";}
    else if(convertedsource[0]==1) {
    returnvalue[0]="NONE";
    returnvalue[1]="1";}
    else{
    returnvalue[0]="0";
    returnvalue[1]="NONE";}
    return returnvalue;
   }
   public static void main(String[] args){
	   String f="";
	   String result[]=new String[2];
	   try{
		   BufferedReader read= new BufferedReader(new InputStreamReader(System.in));
		   f=read.readLine();
	      }
	   catch(Exception ex){ex.printStackTrace();}
       result=decode(f);
       System.out.println(result[0]+" "+result[1]);
       System.exit(0);
   }
}